@set path=E:\shang\finance\deploy

@echo off
echo get Administrator permission
cacls.exe "%SystemDrive%\System Volume Information" >nul 2>nul
if %errorlevel%==0 goto Admin
if exist "%temp%\getadmin.vbs" del /f /q "%temp%\getadmin.vbs"
echo Set RequestUAC = CreateObject^("Shell.Application"^)>"%temp%\getadmin.vbs"
echo RequestUAC.ShellExecute "%~s0","","","runas",1 >>"%temp%\getadmin.vbs"
echo WScript.Quit >>"%temp%\getadmin.vbs"
"%temp%\getadmin.vbs" /f
if exist "%temp%\getadmin.vbs" del /f /q "%temp%\getadmin.vbs"
exit

:Admin
echo get Administrator permission success

%path%\srvany\instsrv.exe Tonghui_finance %path%\srvany\srvany.exe
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tonghui_finance\Parameters /v AppDirectory /d "%path%" /t reg_sz /f
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tonghui_finance\Parameters /v Application /d "%path%\run.bat" /t reg_sz /f
pause